package factorymodel;

import factorymodel.impl.Apple;
import factorymodel.impl.Grape;

public class FruitFactory {
    public final static int TYPE_APPLE=1;
    public final static int TYPE_GRAPE=2;

    public static Fruit creatFruit(int type){
        switch (type){
            case TYPE_APPLE:
                return new Apple();
            case TYPE_GRAPE:
                return new Grape();
            default:
                throw new RuntimeException("该工厂生产不了该水果"+type);
        }
    }

    private FruitFactory(){}
}
